<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        //阶乘
        //n!
        //1*2*3...*n

        //1   1
        //2   1! * 2
        //3   2! * 3
        //4   3! * 4
        //n   (n-1)!*n

        //1  1
        //2  2
        //3  6
        function factorial(n) {
			if(n == 1) {
				return 1;
			}
			return factorial(n-1) * n;
		}

        console.log(factorial(5));
		
    </script>
</head>
<body>

</body>
</html>